package com.hmkj.core.po.user;

import com.hmkj.common.baseMapper.GenericPo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Table;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Consumer;


/**
 * 用户冻结表实体信息<br>
 *
 * @author Vector
 * @date   2017-11-03 11:03:42
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(description = "用户冻结表")
@Table(name = "biz_user_freeze")
public class UserFreeze extends GenericPo<Integer> {

    public static final String TABLE_NAME = "biz_user_freeze";

	
	/**用户id**/
	@ApiModelProperty(value = "用户id")
	private Integer userId;
	/**登录冻结**/
	@ApiModelProperty(value = "登录冻结")
	private Integer freezingLogin;
	/**充值冻结**/
	@ApiModelProperty(value = "充值冻结")
	private Integer freezeRecharge;
	/**提现冻结**/
	@ApiModelProperty(value = "提现冻结")
	private Integer freezeCash;
	/**点买冻结**/
	@ApiModelProperty(value = "点买冻结")
	private Integer freezeTender;
	/**备注**/
	@ApiModelProperty(value = "备注")
	private String remark;

    public enum STATUS {

        /**1,未冻结:T1**/
        T1("未冻结",1),

        /**2,冻结:T2**/
        T2("冻结",2);

        public final int code;
        public final String value;
        private static Map<Integer, String> map = new HashMap<Integer, String>();

        private STATUS(String value, int code) {
            this.code = code;
            this.value = value;
        }

        public static String getValue(Integer code) {
            if (null == code) {
                return null;
            }
            for (UserBank.STATUS status : UserBank.STATUS.values()) {
                if (status.code == code) {
                    return status.value;
                }
            }
            return null;
        }

        public static Integer getCode(String value) {
            if (null == value  || "".equals(value)) {
                return null;
            }
            for (UserBank.STATUS status : UserBank.STATUS.values()) {
                if (status.value.equals(value)) {
                    return status.code;
                }
            }
            return null;
        }

        public static  Map<Integer, String> getEnumMap() {
            if(map.size() == 0){
                for (UserBank.STATUS status : UserBank.STATUS.values()) {
                    map.put(status.code,status.value);
                }
            }
            return map;
        }
    }

    public UserFreeze(){}

    public UserFreeze(Consumer<UserFreeze> consumer){
    consumer.accept(this);
    }
}

